Compute shadow grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=float), | intent(in) | :: | az | |||
real(kind=float), | intent(in) | :: | sunHeight | |||
type(ViewingAngle), | intent(in) | :: | view(:,:) | |||
type(grid_real), | intent(inout) | :: | grid |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
real(kind=float), | public | :: | azDiff | ||||
real(kind=float), | public | :: | azDiffMin | ||||
integer(kind=short), | public | :: | i | ||||
integer(kind=short), | public | :: | j | ||||
integer(kind=short), | public | :: | l | ||||
integer(kind=short), | public | :: | m |
SUBROUTINE CastShadow & ! ( az, sunHeight, view, grid) IMPLICIT NONE !Arguments with intent(in): REAL (KIND = float), INTENT(in) :: az !current sun azimuth [rad] REAL (KIND = float), INTENT(in) :: sunHeight !current sun height [rad] TYPE (ViewingAngle), INTENT(in) :: view (:,:) !Arguments with intent(inout): TYPE (grid_real) , INTENT(inout) :: grid !local declarations INTEGER (KIND = short) :: i, j, m, l REAL (KIND = float) :: azDiff, azDiffMin !----------------------------end of declarations------------------------------- !search for closer azimuth to current sun azimuth azDiffMin = 100. l = 0 DO m = 1, SIZE (azimuth) azDiff = ABS ( azimuth (m) - az) IF ( azDiff < azDiffMin) THEN azDiffMin = azDiff l = m END IF END DO DO i = 1, grid % idim DO j = 1, grid % jdim IF ( grid % mat (i,j) /= grid % nodata ) THEN IF (sunHeight < view (i,j) % angle (l) ) THEN grid % mat (i,j) = 1 ELSE grid % mat (i,j) = 0 END IF END IF END DO END DO RETURN END SUBROUTINE CastShadow